home *** CD-ROM | disk | FTP | other *** search
/ Iron Maiden - Maiden Hell! / Iron Maiden - Maiden Hell! Promotional CD-ROM.iso / mac / Xtras / Director 6.5 Behaviors / QT3 Behavior Library.cst / 00004_autoRotate.ls < prev    next >
Encoding:
Text File  |  1998-04-19  |  1.7 KB  |  68 lines

  1. -- Auto-rotate
  2. --Rotates a QT3 Sprite by a fixed number of degrees per frame. 
  3. --
  4. --PARAMETERS: 
  5. --
  6. --Initial Rotation - Specify the starting rotation for the sprite 
  7. --Rotate Degrees   - Specify the number of degrees to rotate each frame 
  8. --                   (+: clockwise, -: counter-clockwise)
  9.  
  10. property rotateDelta
  11. property initialRotation
  12. property bFirstFrame
  13.  
  14. on beginSprite me
  15.   set bFirstFrame = true
  16. end
  17.  
  18. on prepareFrame me
  19.   if bFirstFrame then
  20.     set the rotation of sprite the spritenum of me to initialrotation
  21.     set bFirstFrame = false
  22.   end if
  23.   
  24.   set newrotation = the rotation of sprite the spritenum of me + rotateDelta
  25.   if newrotation > 360 then
  26.     set newrotation = newrotation - 360
  27.   end if
  28.   if newrotation < 0 then
  29.     set newrotation = newrotation + 360
  30.   end if
  31.   
  32.   set tempRotation = the rotation of sprite the spritenum of me
  33.   
  34.   if tempRotation <> newrotation then
  35.     set the rotation of sprite the spritenum of me to newrotation
  36.   end if
  37. end  
  38.  
  39. on exitFrame me
  40. end
  41.  
  42.  
  43. ---
  44.  
  45. on getPropertyDescriptionList
  46.   
  47.   set p_list = [ ¬¨
  48.    #initialRotation: [ #comment:  "Initial rotation:", ¬¨
  49.                        #format:   #float, ¬¨
  50.                        #default:   0.0 ], ¬¨
  51.        #rotateDelta: [ #comment:  "Rotate degrees per frame:", ¬¨
  52.                        #format:   #float, ¬¨
  53.                        #default:   10.0 ] ¬¨
  54.                ]
  55.   return p_list  
  56.   
  57. end
  58.  
  59. on getBehaviorDescription
  60.   return ¬¨
  61. "Rotates a QT3 Sprite by a fixed number of degrees per frame." && RETURN & RETURN &¬¨
  62. "PARAMETERS:" && RETURN & ¬¨
  63.   "Initial Rotation - Specify the starting rotation for the sprite" && RETURN & ¬¨
  64.   "Rotate Degrees - Specify the number of degrees to rotate each frame (+: clockwise, -: counter-clockwise"
  65.   
  66. end
  67.  
  68.